package com.cyj.dream.admin.contacts.enums;

import com.cyj.dream.admin.util.IsEmptyUtils;

/**
 * @Description: web端文件上传枚举封装
 * @BelongsProject: dream-DreamChardonnay
 * @BelongsPackage: com.dream.DreamChardonnay.constant.enums
 * @Author: ChenYongJia
 * @CreateTime: 2021-07-06 15:56
 * @Email: chen87647213@163.com
 * @Version: 1.0
 */
public enum SysFileTypePreEnum {

    /**
     * 用户类型(0:内部用户 1:客户 2:会员)
     * 微信端 性别 0:未知 1:男 2:女
     */
    FILE_DOC("doc",7),
    FILE_DOCX("docx", 7),
    FILE_PPT("ppt", 10),
    FILE_PPTX("pptx", 10),
    FILE_XLS("xls", 8),
    FILE_XLSX("xlsx", 8),;

    private String code;
    private Integer message;

    SysFileTypePreEnum(String code, Integer message) {
        this.code = code;
        this.message = message;
    }

    /**
     * 根据 类型编码 来获取 描述信息
     *
     * @param code
     * @return
     */
    public static Integer getMessByCode(String code) {
        if (IsEmptyUtils.isEmpty(code)) {
            return null;
        }

        for (SysFileTypePreEnum fileTypePreEnum : values()) {
            if (fileTypePreEnum.getCode().equals(code)) {
                return fileTypePreEnum.getMessage();
            }
        }
        throw new RuntimeException("没有找到对应的描述信息");
    }

    public String getCode() {
        return code;
    }

    public Integer getMessage() {
        return message;
    }

}
